RefTeX
scans the document in order to find all labels. To make
referencing labels easier, it assigns to each label a category,
the label type (for example section, table, figure,
equation, etc.). In order to determine the label type, RefTeX
parses around each label to see in what kind of environments it
is located. You can speed up the parsing by using type-specific
prefixes for labels and configuring the variable
reftex-trust-label-prefix.
Referencing Labels is really at the heart of RefTeX. Press C-c ) in order to reference a label (reftex-reference). This will start a selection process and finally insert the complete ‘\ref{label}’ into the buffer.
First, RefTeX will determine the label category which is required. Often that can be figured out from context. For example, if you write ‘As shown in eq.’ and the press C-c ), RefTeX knows that an equation label is going to be referenced. If it cannot figure out what label category is needed, it will query for one.
You will then be presented with a label selection menu. This is a special buffer which contains an outline of the document along with all labels of the given label category. In addition, next to the label there will be one line of context of the label definition, which is some text in the buffer near the label definition. Usually this is sufficient to identify the label. If you are unsure about a certain label, pressing <SPC> will show the label definition point in another window.
In order to reference a label, move to cursor to the correct
label and press <RET>. You can also reference several
labels with a single call to reftex-reference by
marking entries with the m key (see below).
Here is a list of special commands in the selection buffer. A summary of this information is always available from the selection process by pressing ?.
reftex-revisit-to-follow.reftex-reference.reftex-highlight-selection, Options
(Misc).
\ref macros. The special
markers ‘,-+’ also store a separator to be
inserted before the corresponding reference. So marking six
entries with the keys ‘m , , -
, +’ will give a reference list like this
(see the variable reftex-multiref-punctuation)
In eqs. (1), (2), (3)--(4), (5) and (6)
\ref
macro. Some packages like saferef.sty support multiple references in
this way.\ref and \vref macro for
references. The \vref macro is defined in the
varioref LaTeX package. With this key you can
force RefTeX to insert a \vref macro. The
current state of this flag is displayed by the
‘S<>’
indicator in the mode line of the selection buffer.\ref, \fref and
\Fref. The \fref and
\Fref macros are defined in the
fancyref LaTeX package. With this key you can
force RefTeX to insert a \fref or
\Fref macro. The current state of this flag is
displayed by the ‘S<>’ indicator in the mode
line of the selection buffer.reftex-label-menu-flags (see
Options (Referencing Labels)).reftex-enable-partial-scans is
non-nil and your document is a multifile document,
this will reparse only a part of the document (the file in
which the label at point was defined).xr it is possible to reference labels
defined in another document. This key will switch to the label
menu of an external document and let you select a label from
there (see xr).In order to
define additional commands for the selection process, the keymap
reftex-select-label-map may be used.